package com.wu.acw.server;

import java.net.URLEncoder;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;

public class URLEncodingDecoding {
    public static void main(String[] args) {
        String originalString = "{\"tags\":\\[2\\]}";
        String encodedString;
        String decodedString;

        // 编码
        encodedString = URLEncoder.encode(originalString, StandardCharsets.UTF_8);
        System.out.println("编码后的字符串: " + encodedString);

        // 解码
        decodedString = URLDecoder.decode(originalString, StandardCharsets.UTF_8);
        System.out.println("解码后的字符串: " + decodedString);
    }
}